1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gdk.MonitorGdk; 26 27 private import gdk.Display; 28 private import gdk.c.functions; 29 public import gdk.c.types; 30 private import glib.Str; 31 private import glib.c.functions; 32 private import gobject.ObjectG; 33 private import gobject.Signals; 34 private import std.algorithm; 35 36 37 /** 38 * `GdkMonitor` objects represent the individual outputs that are 39 * associated with a `GdkDisplay`. 40 * 41 * `GdkDisplay` keeps a `GListModel` to enumerate and monitor 42 * monitors with [method@Gdk.Display.get_monitors]. You can use 43 * [method@Gdk.Display.get_monitor_at_surface] to find a particular 44 * monitor. 45 */ 46 public class MonitorGdk : ObjectG 47 { 48 /** the main Gtk struct */ 49 protected GdkMonitor* gdkMonitor; 50 51 /** Get the main Gtk struct */ 52 public GdkMonitor* getMonitorGdkStruct(bool transferOwnership = false) 53 { 54 if (transferOwnership) 55 ownedRef = false; 56 return gdkMonitor; 57 } 58 59 /** the main Gtk struct as a void* */ 60 protected override void* getStruct() 61 { 62 return cast(void*)gdkMonitor; 63 } 64 65 /** 66 * Sets our main struct and passes it to the parent class. 67 */ 68 public this (GdkMonitor* gdkMonitor, bool ownedRef = false) 69 { 70 this.gdkMonitor = gdkMonitor; 71 super(cast(GObject*)gdkMonitor, ownedRef); 72 } 73 74 75 /** */ 76 public static GType getType() 77 { 78 return gdk_monitor_get_type(); 79 } 80 81 /** 82 * Gets the name of the monitor's connector, if available. 83 * 84 * Returns: the name of the connector 85 */ 86 public string getConnector() 87 { 88 return Str.toString(gdk_monitor_get_connector(gdkMonitor)); 89 } 90 91 /** 92 * Gets the display that this monitor belongs to. 93 * 94 * Returns: the display 95 */ 96 public Display getDisplay() 97 { 98 auto __p = gdk_monitor_get_display(gdkMonitor); 99 100 if(__p is null) 101 { 102 return null; 103 } 104 105 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p); 106 } 107 108 /** 109 * Retrieves the size and position of the monitor within the 110 * display coordinate space. 111 * 112 * The returned geometry is in ”application pixels”, not in 113 * ”device pixels” (see [method@Gdk.Monitor.get_scale_factor]). 114 * 115 * Params: 116 * geometry = a `GdkRectangle` to be filled with the monitor geometry 117 */ 118 public void getGeometry(out GdkRectangle geometry) 119 { 120 gdk_monitor_get_geometry(gdkMonitor, &geometry); 121 } 122 123 /** 124 * Gets the height in millimeters of the monitor. 125 * 126 * Returns: the physical height of the monitor 127 */ 128 public int getHeightMm() 129 { 130 return gdk_monitor_get_height_mm(gdkMonitor); 131 } 132 133 /** 134 * Gets the name or PNP ID of the monitor's manufacturer. 135 * 136 * Note that this value might also vary depending on actual 137 * display backend. 138 * 139 * The PNP ID registry is located at 140 * [https://uefi.org/pnp_id_list](https://uefi.org/pnp_id_list). 141 * 142 * Returns: the name of the manufacturer 143 */ 144 public string getManufacturer() 145 { 146 return Str.toString(gdk_monitor_get_manufacturer(gdkMonitor)); 147 } 148 149 /** 150 * Gets the string identifying the monitor model, if available. 151 * 152 * Returns: the monitor model 153 */ 154 public string getModel() 155 { 156 return Str.toString(gdk_monitor_get_model(gdkMonitor)); 157 } 158 159 /** 160 * Gets the refresh rate of the monitor, if available. 161 * 162 * The value is in milli-Hertz, so a refresh rate of 60Hz 163 * is returned as 60000. 164 * 165 * Returns: the refresh rate in milli-Hertz, or 0 166 */ 167 public int getRefreshRate() 168 { 169 return gdk_monitor_get_refresh_rate(gdkMonitor); 170 } 171 172 /** 173 * Gets the internal scale factor that maps from monitor coordinates 174 * to device pixels. 175 * 176 * On traditional systems this is 1, but on very high density outputs 177 * it can be a higher value (often 2). 178 * 179 * This can be used if you want to create pixel based data for a 180 * particular monitor, but most of the time you’re drawing to a surface 181 * where it is better to use [method@Gdk.Surface.get_scale_factor] instead. 182 * 183 * Returns: the scale factor 184 */ 185 public int getScaleFactor() 186 { 187 return gdk_monitor_get_scale_factor(gdkMonitor); 188 } 189 190 /** 191 * Gets information about the layout of red, green and blue 192 * primaries for pixels. 193 * 194 * Returns: the subpixel layout 195 */ 196 public GdkSubpixelLayout getSubpixelLayout() 197 { 198 return gdk_monitor_get_subpixel_layout(gdkMonitor); 199 } 200 201 /** 202 * Gets the width in millimeters of the monitor. 203 * 204 * Returns: the physical width of the monitor 205 */ 206 public int getWidthMm() 207 { 208 return gdk_monitor_get_width_mm(gdkMonitor); 209 } 210 211 /** 212 * Returns %TRUE if the @monitor object corresponds to a 213 * physical monitor. 214 * 215 * The @monitor becomes invalid when the physical monitor 216 * is unplugged or removed. 217 * 218 * Returns: %TRUE if the object corresponds to a physical monitor 219 */ 220 public bool isValid() 221 { 222 return gdk_monitor_is_valid(gdkMonitor) != 0; 223 } 224 225 /** 226 * Emitted when the output represented by @monitor gets disconnected. 227 */ 228 gulong addOnInvalidate(void delegate(MonitorGdk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 229 { 230 return Signals.connect(this, "invalidate", dlg, connectFlags ^ ConnectFlags.SWAPPED); 231 } 232 }